<%@page pageEncoding="UTF-8" %>
<!doctype html>
<html lang="zh-cmn">
<head>
    <title>Document</title>
    <%@include file="/WEB-INF/jsp/header.jsp"%>
</head>
<body>
<div class="container-fluid">
    <div class="panel panel-info">
        <div class="panel-heading">
            <h3 class="panel-title">条件查询</h3>
        </div>
        <div class="panel-body">
            <form class="form-inline" id="takestoForm" action="">
                <div class="form-group">
                    <label for="">
                        盘点编号:
                    </label>
                    <input type="text" name="invNum" class="form-control" />
                </div>
                <div class="form-group">
                    <label for="">
                        盘点时间:
                    </label>
                    <input type="text" name="startDate" class="form-control" />
                </div>
                <div style="height: 10px;"></div>
                <div class="form-group">
                    <label for="">
                        盘点状态:
                    </label>
                    <select name="invState" id="invState" class="form-control" style="width: 200px;">
                        <option value="-1">==请选择==</option>
                        <option value="0">待校正</option>
                        <option value="1">已校正</option>
                    </select>
                </div>
                <div class="form-group">
                    <label for="" style="width: 60px;"></label>
                    <input type="text" name="endDate" class="form-control" />
                </div>

                <button class="btn btn-success" type="button" onclick="search()" >搜索</button>
            </form>
        </div>
    </div>
    <table id="TakestoTable"
        data-toggle="table"
        data-url="${ctx}/stock/searchTakessto"
        data-pagination="true"
        data-side-pagination="server"
        data-page-list="[5,10,15,30]"
    >
        <thead>
            <tr>
                <th data-field="invNum">盘点编号</th>
                <th data-field="invDate">盘点时间</th>
                <th data-field="invPers">盘点人员</th>
                <th data-field="invAuditper">审查人员</th>
                <th data-field="invState" data-formatter="optState">盘点状态</th>
                <th data-formatter="optEvent" data-events="optEvents"></th>
            </tr>
        </thead>
    </table>
</div>

<%@include file="/WEB-INF/jsp/footer.jsp"%>
<script>
    $(function () {
        var msg = '${msg}';
        if(msg!=null && msg!=''){
            toastr.info(msg);
        }
    })
    //搜索
    function search() {
        var param = {};
        param.invNum = $("#takestoForm [name=invNum]").val();//盘点编号
        param.startDate = $("#takestoForm [name=startDate]").val();//开始时间
        param.endDate = $("#takestoForm [name=endDate]").val();//结束时间
        param.invState = $("#invState").val();//盘点人员
        $("#TakestoTable").bootstrapTable("refresh",{query:param})
    }
    //搜索日期插件
    $(function () {
        laydate.render({
            elem:'[name=startDate]'
        })
        laydate.render({
            elem:'[name=endDate]'
        })
    });
    //操作
    function optEvent() {
        return '<button class="layui-btn layui-btn-normal layui-btn-mini display" type="button" >查看</button>'
    }
    $(function () {
        $('#invPers').select2({
            placeholder: "请选择",
            language: "zh-CN"
        });
        $("#invPers").select2();
    })
    function optState(v){
        return v==0?"待校正":"<span style='color: greenyellow;font-weight: bold'>已校正</span>";
    }
    window.optEvents={
        "click .display":function (e,value,row) {
            var invNum = row.invNum;
            location.href=ctx+"/stock/takestoDetails?invNum="+invNum;
        }
    }
</script>
</body>
</html>
